<html>
<body>
<?php
require("config.php");
?>
<a href=login.php>Login</a> <a href=register.php>Register</a></br>
<?php
$query = "SELECT * FROM tricks";
$result = mysql_query($query);
$number = mysql_numrows($result);
if ($number == 0){
  echo "I haven't tricks.";
}elseif ($number > 0){
  $num = rand(0, $number - 1);  
  echo "Tricks count: $number</br>";
  $name = mysql_result($result,$num,"name");
  $trick = mysql_result($result,$num,"trick");
  echo "<h1>$trick</h1> by $name</br>\n";
};
?>
<hr>
<i>Created by Andrue Konstantinov</i>
</body>
</html>
